package org.cn.lennon.mybatis.test.mapper;

import org.cn.lennon.mybatis.annotation.SqlAnnotation;
import org.cn.lennon.mybatis.annotation.SqlMapperAnnotation;
import org.cn.lennon.mybatis.executors.OperationType;
import org.cn.lennon.mybatis.test.bean.UserBean;

@SqlMapperAnnotation
public interface UserMapperAnntation {

	@SqlAnnotation( sql = "select * from t_user t where t.id = ?", resultType = UserBean.class)
	UserBean getUserBeanById(Integer id);
	
	@SqlAnnotation( sql = "select * from t_user t where t.name = ? and t.password = ?", resultType = UserBean.class)
	UserBean getUserBeanByNameAndPassword(String userName, String password);
	
	@SqlAnnotation( sql = "update t_user set name = ? , password = ? where id = ?", type = OperationType.UPDATE)
	int updateUserById(String name, String paswsord, Integer id);
	
	@SqlAnnotation( sql = "insert into t_user(name, password) value(?, ?)", type = OperationType.INSERT)
	int insertUserBean(String name, String paswsord);

	@SqlAnnotation( sql = "delete from t_user where id = ?", type = OperationType.DELETE)
	int deleteUserById(Integer id);
	
}
